﻿Imports System.Data.Common
Imports ConexionBD

Public Class Municipio
    Public idMun, codDep, codMun, descripcion As String

    Public Shared Function ConsxDpto(ByRef munip As Municipio) As DataTable
        Dim conexion As New ConexionBD.ConexionBD()
        Dim dtConsulta As New DataTable
        If conexion.Conectar() Then
            Dim sentencia As String
            sentencia = "select * from MUNICIPIO where COD_DPTO=@COD_DPTO ORDER BY DESCRIPCION"
            conexion.ParametroEntrada = New List(Of DbParameter)
            conexion.ParametroEntrada.Add(ConexionBD.ConexionBD.ParamInString(conexion, munip.codDep, "COD_DPTO"))
            dtConsulta = conexion.Consulta(sentencia)
            conexion.Desconectar()
        End If
        Return dtConsulta
    End Function

    Public Shared Function ConsMunicipio(ByRef munip As Municipio) As DataTable
        Dim conexion As New ConexionBD.ConexionBD()
        Dim dtConsulta As New DataTable
        If conexion.Conectar() Then
            Dim sentencia As String
            sentencia = "select * from MUNICIPIO where ID_MUNICIPIO=@ID_MUNICIPIO ORDER BY DESCRIPCION"
            conexion.ParametroEntrada = New List(Of DbParameter)
            conexion.ParametroEntrada.Add(ConexionBD.ConexionBD.ParamInString(conexion, munip.codMun, "ID_MUNICIPIO"))
            dtConsulta = conexion.Consulta(sentencia)
            conexion.Desconectar()
        End If
        Return dtConsulta
    End Function

End Class
